package net.aiion.weave.impl.web.service.http;

import java.io.IOException;
import java.io.OutputStream;

import javax.servlet.http.HttpServletResponse;

import net.aiion.weave.spi.web.service.WeaveServiceException;
import net.aiion.weave.spi.web.service.WeaveServiceResponse;

public class WeaveServiceResponseImpl implements WeaveServiceResponse
{
    private final HttpServletResponse httpServletResponse;

    public WeaveServiceResponseImpl(final HttpServletResponse aHttpServletResponse) {
        httpServletResponse = aHttpServletResponse;
    }

    @Override
    public OutputStream getOutputStream() {
        try {
            return httpServletResponse.getOutputStream();
        } catch (final IOException e) {
            throw new WeaveServiceException(e);
        }
    }

    @Override
    public void sendRedirect(final String aURI) {
        try {
            httpServletResponse.sendRedirect(aURI);
        } catch (final IOException e) {
            throw new WeaveServiceException(e);
        }
    }
}
